/**
 * Map
 * 允许对象类型作为key
 */
const obj1 = {name: 'aaa'}
const obj2 = {name: 'bbb'}
const map = new Map()
map.set(obj1, 'a')
map.set(obj2, 'b')
console.log(map)


/**
 * 几个方法
 * set,get,delete,has,clear
 */
console.log(map.get(obj2))
console.log(map.has(obj1))
// map.clear()
console.log(map)

/**
 * 遍历
 * 支持forEach
 * 支持for-of
 */
map.forEach((item, key, m) => {
  console.log(item, key, m)
})
for (const [key, value] of map) {
  console.log(key, value)
}
